﻿using System;
using FinPlusComponents;
using QLNet;
using p = FinPlusAnalytics.QLConvParser;

namespace FinPlusAnalytics
{
    public class ZeroCouponBondBuild : FinPlusComponent
    {
        //construct
        public ZeroCouponBondBuild(string marketName, string name, double redemption, int settlementDays, DateTime effectiveDate, DateTime terminationDate, string bondConv, string holidays)
        {
            var market = Markets.Instance.GetMarket(marketName); 
            var calendar = p.Calendar(holidays);
            var bond = new QLNet.ZeroCouponBond(settlementDays, calendar, 100, terminationDate, p.BizConv(bondConv), redemption, effectiveDate);

            market.GetBond(name).linkTo(bond);
        }
    }
}
